#!/usr/bin/env ruby

#
# Created by UNA CDE.
# User: bposerow@gmail.com
# Date: Feb 4, 2009
# Time: 8:21:43 PM
#
# To change this template use Preferences | File Templates.
#

require 'test/unit'
require File.dirname(__FILE__) + '/../source/dir_builder'
require File.dirname(__FILE__) + '/../source/file_based_document'

class FileBasedDocumentTest < Test::Unit::TestCase
  def setup
    hierarchy = [
        [ 'testdir', nil ],
        [ 'testdir/abc.txt', 'a b c' ]
    ]
        
    @db = DirBuilder.new(hierarchy)
    @db.build
        
    @abcDocument = FileBasedDocument.new("testdir/abc.txt");
  end
    
  def teardown
    @db.raze    
  end
    
  def test_has_right_length
    assert_equal(3, @abcDocument.length)
  end
  
  def test_has_right_contents
    assert_equal(["a", "b", "c"], @abcDocument.words)
  end
end
